import { Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
import { dateTransformer } from '../../../../common/utils';

@Entity('conversation_records', {
  comment: '对话记录表，存储详细的对话内容和AI回复',
})
export class RecordsEntity {
  @PrimaryGeneratedColumn({ type: 'int', name: 'id', comment: 'id' })
  public id: number;

  @Column({ type: 'varchar', name: 'session_id', default: '', comment: '会话ID，用于关联同一场对话' })
  public sessionId: string;

  @Column({ type: 'text', name: 'content', default: null, comment: '消息内容' })
  public content: string;

  @Column({ type: 'text', name: 'ai_reply', default: null, comment: '回复内容' })
  public aiReply: string;

  @Column({ type: 'char', name: 'del_flag', default: false, comment: '删除标志' })
  public delFlag: string;

  @CreateDateColumn({ type: 'datetime', name: 'create_time', default: null, transformer: dateTransformer, comment: '创建时间' })
  public createTime: Date;

  @UpdateDateColumn({ type: 'datetime', name: 'update_time', default: null, transformer: dateTransformer, comment: '更新时间' })
  public updateTime: Date;
}
